from django.db import models
from myconstants import MyConstants
from portal.models import Portal
from django.forms.models import ModelForm
from django import forms
from django.forms.extras.widgets import SelectDateWidget

class Friend(models.Model):
    RELATIONS_CHOICES = ((1, u"No"), (2, u"Poor"), (3, u"Good"), (4, u"Friend"))
    
    status_id = models.SmallIntegerField(choices = MyConstants.STATUS_CHOICES, default = MyConstants.STATUS_APPROVED)
    portal_id = models.ForeignKey(Portal)
    nick = models.CharField(max_length = 128)

    text = models.CharField(max_length = 1024, blank = True)
    did_i_write = models.BooleanField(blank = True)
    was_answered = models.BooleanField(blank = True)
    relations = models.SmallIntegerField(choices = RELATIONS_CHOICES)

    birth_date = models.DateField(blank = True)
    
    
class FriendForm(ModelForm):
    class Meta:
        model = Friend
        widgets = {
            "birth_date": SelectDateWidget()
        }
